﻿Imports Mysoft.Map.Data

Partial Class DocumentRights_Edit
    Inherits Mysoft.Map.Application.Security.AppPage

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '在此处放置初始化页的用户代码
        '设置窗口标题
        Dim strProjResultTypeGUID As String
        Dim strSQL As String

        '获取集团GUID
        txtJTGUID.Text = MyDB.GetDataItemString("SELECT TOP 1 BUGUID FROM myBusinessUnit WHERE Level = 0")

        strProjResultTypeGUID = Request.QueryString("DocuemntGUID")

        DocumentDir.Text = Request.QueryString("DocuemntDir")
        DocumentGUID.Text = Request.QueryString("DocuemntGUID")



        Data_Bind(strProjResultTypeGUID)
    End Sub


    Private Sub Data_Bind(ByVal strProjResultTypeGUID As String)
        Dim dtTemp As DataTable
        Dim strSQL As String
        Dim strWhere As String = " (1=2) "

        If strProjResultTypeGUID = "" Or strProjResultTypeGUID Is Nothing Then
            strWhere = " 1=2 "
        Else
            strWhere = " StationUserGUID in (SELECT UserGUID FROM jd_PubDataRights WHERE DataGUID='" & strProjResultTypeGUID & "')"
        End If

        strSQL = " SELECT * FROM (select UserGUID as StationUserGuid,'用户' as Type,UserName as StationUserName " & _
                 " from myUser" & _
                 " where " & strWhere.Replace("StationUserGUID", "UserGUID") & _
                  "UNION select StationGuid as StationUserGuid,'岗位' as Type,StationName as StationUserName " & _
                 " from myStation" & _
                 " where " & strWhere.Replace("StationUserGUID", "StationGUID") & _
                 " ) a ORDER BY a.Type,a.StationUserName "

        dtTemp = MyDB.GetDataTable(strSQL)

        '自定义控件绑定数据
        Repeater1.BindMode = 1                                          '绑定模式：0 -- SQL 语句绑定，1 -- DataTable 绑定
        Repeater1.DataTable = dtTemp
        Repeater1.DataBind()                                            '绑定数据

    End Sub

   
End Class
